package com.luncheng.mcp.core;

import com.luncheng.mcp.core.router.DynamicRouterProvider;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.stereotype.Component;

@Component
public class DynamicRefresher implements ApplicationListener<ContextRefreshedEvent> {
    @Autowired
    private DynamicRouterProvider dynamicRouterProvider;

    @Override
    public void onApplicationEvent(ContextRefreshedEvent event) {
        dynamicRouterProvider.refreshRouter();
    }
}